package bishi.diezhi;

import java.util.*;

public class diezhi2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case
            String s1 = in.next();
            String s2 = in.next();
            String nums = s1.substring(4,s1.length());
            String process = s2.substring(9,s2.length()-1);
            int num = toInt(nums);
            StringBuffer prce = new StringBuffer();
            for(int i = 0;i < s2.length();i++) {
                if(s2.charAt(i) >= '0' && s2.charAt(i) <= '9') {
                    prce.append(s2.charAt(i));

                }
                if(s2.charAt(i) == ',') {
                    prce.append(',');
                }
            }

            Map<Integer,Integer> hash = new HashMap<>();
            String ret=  prce.toString();
            String[] retArry = ret.split(",");
            for(int i =0;i < retArry.length;i = i+2 ) {
                hash.put(toInt(retArry[i]),toInt(retArry[i+1]));

            }
            if(!hash.containsKey(num - 1)) {
                ArrayList<Integer> rett = new ArrayList<>();
                System.out.println(rett);
            }

        }
    }

    static int toInt(String num) {
        int sum = 0;
        for (int i =0;i<num.length();i++) {
            sum = sum * 10;
            int temp = num.charAt(i)-'0';
            sum = sum + temp;
        }
        return sum;
    }
}
